Open
Conversation
https://docs.pytest.org/en/stable/deprecations.html#applying-a-mark-to-a-fixture-function notes that applying a mark to a fixture function never had any effect. It raises an exception during test collection with pytest 9.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #986 +/- ##
==========================================
+ Coverage 88.18% 88.28% +0.09%
==========================================
Files 32 32
Lines 1007 1007
Branches 105 105
==========================================
+ Hits 888 889 +1
+ Misses 101 100 -1
Partials 18 18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
|
Should that decorator still work with https://pypi.org/project/pytest-django ? |
Author
|
I'm not sure I understand the question, sorry. The rule that you can't use marks on fixtures comes from pytest itself. |
auvipy
reviewed
Jan 11, 2026
| class test_DatabaseSchedulerFromAppConf(SchedulerCase): | ||
| Scheduler = TrackingScheduler | ||
|
|
||
| @pytest.mark.django_db |
Author
There was a problem hiding this comment.
The link I posted in the issue description explains it. This is a mark applied to a fixture function. With pytest<9 it was a no-op; with pytest>=9 it is an error. It doesn't matter what the mark is.
The mark that actually matters is the one applied to the class, which my PR doesn't touch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://docs.pytest.org/en/stable/deprecations.html#applying-a-mark-to-a-fixture-function notes that applying a mark to a fixture function never had any effect. It raises an exception during test collection with pytest 9.